package com.htc.android.footprints.provider;

import android.content.ContentUris;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteQueryBuilder;
import android.net.Uri;

public class CategoryProvider
  implements ISubProvider
{
  private static final Uri BaseURI = Uri.parse("content://com.htc.android.footprints.provider.FootprintContentProvider/category");
  private static final String TABLE = "category";
  private static final String TAG = "CategoryProvider";
  private Context mContext;
  private SQLiteDatabase mDB;

  private void initData(SQLiteDatabase paramSQLiteDatabase)
  {
    paramSQLiteDatabase.execSQL("INSERT INTO category(keyword,name,icon_id) values('favorite','Favorites',2130837702)");
    paramSQLiteDatabase.execSQL("INSERT INTO category(keyword,name,icon_id) values('shopping','Shopping',2130837739)");
    paramSQLiteDatabase.execSQL("INSERT INTO category(keyword,name,icon_id) values('dining','Dining',2130837737)");
    paramSQLiteDatabase.execSQL("INSERT INTO category(keyword,name,icon_id) values('leisure','Leisure',2130837726)");
    paramSQLiteDatabase.execSQL("INSERT INTO category(keyword,name,icon_id) values('other','Others',2130837736)");
  }

  public int delete(Uri paramUri, String paramString, String[] paramArrayOfString)
  {
    if (CategoryColumns.CONTENT_URI.equals(paramUri))
      return this.mDB.delete("category", paramString, paramArrayOfString);
    throw new IllegalArgumentException("Unknown URL " + paramUri);
  }

  public Uri getBaseURI()
  {
    return BaseURI;
  }

  public String getType(Uri paramUri)
  {
    return "";
  }

  public Uri insert(Uri paramUri, ContentValues paramContentValues)
  {
    if (paramContentValues != null);
    for (ContentValues localContentValues = new ContentValues(paramContentValues); !CategoryColumns.CONTENT_URI.equals(paramUri); localContentValues = new ContentValues())
      throw new IllegalArgumentException("Unknown URL " + paramUri);
    if (!localContentValues.containsKey("keyword"))
      throw new SQLException("Failed to insert row into " + paramUri + " (null keyword)");
    if (!localContentValues.containsKey("name"))
      throw new SQLException("Failed to insert row into " + paramUri + " (null group)");
    if (!localContentValues.containsKey("icon_id"))
      throw new SQLException("Failed to insert row into " + paramUri + " (null icon_id)");
    long l = this.mDB.replace("category", "keyword", localContentValues);
    if (l > 0L)
      return ContentUris.withAppendedId(CategoryColumns.CONTENT_URI, l);
    throw new SQLException("Failed to insert row into " + paramUri);
  }

  public void onCreate(SQLiteDatabase paramSQLiteDatabase)
  {
    paramSQLiteDatabase.execSQL("CREATE TABLE category (keyword TEXT primary key ,name TEXT ,icon_id integer);");
    initData(paramSQLiteDatabase);
  }

  public void onDrop(SQLiteDatabase paramSQLiteDatabase)
  {
    paramSQLiteDatabase.execSQL("DROP TABLE IF EXISTS category");
  }

  public Cursor query(Uri paramUri, String[] paramArrayOfString1, String paramString1, String[] paramArrayOfString2, String paramString2)
  {
    SQLiteQueryBuilder localSQLiteQueryBuilder = new SQLiteQueryBuilder();
    if (CategoryColumns.CONTENT_URI.equals(paramUri))
    {
      localSQLiteQueryBuilder.setTables("category");
      return localSQLiteQueryBuilder.query(this.mDB, paramArrayOfString1, paramString1, paramArrayOfString2, null, null, null);
    }
    throw new IllegalArgumentException("Unknown URL " + paramUri);
  }

  public void setContext(Context paramContext)
  {
    this.mContext = paramContext;
  }

  public void setDB(SQLiteDatabase paramSQLiteDatabase)
  {
    this.mDB = paramSQLiteDatabase;
  }

  public int update(Uri paramUri, ContentValues paramContentValues, String paramString, String[] paramArrayOfString)
  {
    if (CategoryColumns.CONTENT_URI.equals(paramUri))
      return this.mDB.update("category", paramContentValues, paramString, paramArrayOfString);
    throw new IllegalArgumentException("Unknown URL " + paramUri);
  }

  public static final class CategoryColumns
  {
    public static final Uri CONTENT_URI = CategoryProvider.BaseURI;
    public static final String ICON_ID = "icon_id";
    public static final String KEYWORD = "keyword";
    public static final String NAME = "name";
  }
}

/* Location:           E:\workspace\dex2java\dex-translator-0.0.9.3\HtcFootprints_dex2jar.jar
 * Qualified Name:     com.htc.android.footprints.provider.CategoryProvider
 * JD-Core Version:    0.6.0
 */